package com.atguigu.netty.dubborpc.customer;

import com.atguigu.netty.dubborpc.netty.NettyClient;
import com.atguigu.netty.dubborpc.publicinterface.HelloService;

public class ClientBootstrap {

    // 定义协议头
    public static final String providerName = "HelloService#hello";

    public static void main(String[] args) throws InterruptedException {
        // 创建消费者
        NettyClient customer = new NettyClient();

        // 创建代理对象
        HelloService helloService = (HelloService) customer.getBean(HelloService.class, providerName);

        // 通过代理对象调用服务提供者方法
        for (int i = 0; i < 5; i++) {
            Thread.sleep(5 * 1000);
            String resp = helloService.hello("你好，dubbo");

            System.out.println("收到服务端返回结果：" + resp);
            System.out.println();
        }

        customer.closeClient();

    }
}
